package com.xinruke.hostels.reservation.user.controller;

import com.xinruke.hostels.common.controller.BaseController;
import com.xinruke.hostels.common.vo.ResultVO;
import com.xinruke.hostels.reservation.user.interfaces.dto.MemberDetailQuertDTO;
import com.xinruke.hostels.reservation.user.interfaces.dto.MemberDetailQuertResultDTO;
import com.xinruke.hostels.reservation.user.interfaces.dto.MemberPassWordUpdateDTO;
import com.xinruke.hostels.reservation.user.service.MemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 会员管理模块
 *
 * @author Jinz
 * @date 2019-06-30 11:40
 */
@RestController
@RequestMapping("/member")
@Api(tags = "会员管理")
public class MemberController extends BaseController {
    @Autowired
    MemberService memberService;

    /**
     * 会员信息查询
     *
     * @author Jinz
     * @date 2019-06-30 11:42
     */
    @PostMapping("/detail")
    @ApiOperation("会员个人信息")
    public ResultVO<MemberDetailQuertResultDTO> detail(@Valid @RequestBody MemberDetailQuertDTO memberDetailQuertDTO) {
        return memberService.detail(memberDetailQuertDTO);
    }


    /**
     * 会员密码修改
     *
     * @author Jinz
     * @date 2019-06-30 11:42
     */
    @PostMapping("/modifyPwd")
    @ApiOperation("会员密码修改")
    public ResultVO  modifyPwd(@Valid @RequestBody MemberPassWordUpdateDTO memberPassWordUpdateDTO) {
        return memberService.update(memberPassWordUpdateDTO);
    }
}
